import { GLabel } from "../../../../../com/mui/controls/GLabel";
import { ObjCreate } from "../../common/ObjCreate";
import { Language } from "../../../../../extend/language/Language";
import { ItemData } from "../../../resource/info/ItemData";
import { EquipmentItemDataUtil } from "../../common/EquipmentItemDataUtil";
import { HTMLUtil } from "../../../../../com/gengine/utils/HTMLUtil";
import { Vector } from "../../../../../__AS3__/vec/Vector";
type int = number;
//class StrenShiftAttributePanel
    
    export  class StrenShiftAttributePanel /* flash.display.Sprite */
    {
        constructor()
        {
            
            this._labelsVec = new Vector.<GLabel>();
            this._valuesVec = new Vector.<GLabel>();
            this.createChildren();
            return;
        }

        /* internal  */createChildren(): void
        {
            var loc1=0;
            var loc2=0;
            var loc3=0;
            var loc4=null;
            ObjCreate.createBg(0, 0, 140, 150, this);
            ObjCreate.createLabel(Language.getString(60289), 0, 4, 140, 20, flash.text.TextFormatAlign.CENTER, this, true, 16702014);
            this._labelsVec.push(this._label1);
            this._labelsVec.push(this._label2);
            this._labelsVec.push(this._label3);
            this._labelsVec.push(this._label4);
            this._labelsVec.push(this._label5);
            this._labelsVec.push(this._label6);
            this._valuesVec.push(this._value1);
            this._valuesVec.push(this._value2);
            this._valuesVec.push(this._value3);
            this._valuesVec.push(this._value4);
            this._valuesVec.push(this._value5);
            this._valuesVec.push(this._value6);
            loc1 = 0;
            while (loc1 < this._labelsVec.length) 
            {
                loc2 = 10;
                loc3 = 30 + loc1 * 18;
                this._labelsVec[loc1] = ObjCreate.createLabel("", loc2, loc3, 55, 20, flash.text.TextFormatAlign.LEFT, this, true, 16702014);
                ++loc1;
            }
            loc1 = 0;
            while (loc1 < this._valuesVec.length) 
            {
                loc2 = 65;
                loc3 = 30 + loc1 * 18;
                this._valuesVec[loc1] = ObjCreate.createLabel("", loc2, loc3, 100, 20, flash.text.TextFormatAlign.LEFT, this, true, 16702014);
                ++loc1;
            }
            return;
        }

        public setAttributes(arg1: ItemData, arg2: ItemData=null): void
        {
            var loc3=null;
            var loc4=null;
            var loc5=null;
            var loc6=0;
            var loc7=null;
            var loc8=null;
            var loc1=[];
            var loc2=[];
            if (arg1) 
            {
                loc2 = (loc4 = new EquipmentItemDataUtil(arg1)).getBasePropArray();
                loc6 = 0;
                while (loc6 < this._labelsVec.length) 
                {
                    if (loc6 == 0 && arg1) 
                    {
                        this._labelsVec[loc6].htmlText = HTMLUtil.addColor(Language.getString(60290), "#FEDA3E");
                        this._valuesVec[loc6].htmlText = HTMLUtil.addColor(arg1.itemExInfo.strengthen.toString(), "#FEDA3E");
                    }
                    else if (loc6 == 1 && arg1) 
                    {
                        this._labelsVec[loc6].htmlText = HTMLUtil.addColor(Language.getString(60291), "#FEDA3E");
                        this._valuesVec[loc6].htmlText = HTMLUtil.addColor(arg1.itemExInfo.perfectStrengthen + "%", "#FEDA3E");
                    }
                    else if (loc6 < loc2.length + 2 && arg1) 
                    {
                        loc7 = loc2[loc6 - 2];
                        this._labelsVec[loc6].htmlText = HTMLUtil.addColor(loc7["name"], "#FEDA3E");
                        this._valuesVec[loc6].htmlText = HTMLUtil.addColor(loc7["value"], "#FEDA3E");
                        if (arg1.itemExInfo.strengthen > 0) 
                        {
                            loc8 = this.getSpaceStr(loc7["value"]);
                            this._valuesVec[loc6].htmlText = this._valuesVec[loc6].htmlText + HTMLUtil.addColor(loc8 + "（+" + loc4.getBaseAdditive(loc7["value"]) + "）", "#0DF235");
                        }
                    }
                    else 
                    {
                        this._labelsVec[loc6].htmlText = "";
                        this._valuesVec[loc6].htmlText = "";
                    }
                    ++loc6;
                }
            }
            else 
            {
                loc6 = 0;
                while (loc6 < this._labelsVec.length) 
                {
                    this._labelsVec[loc6].htmlText = "";
                    this._valuesVec[loc6].htmlText = "";
                    ++loc6;
                }
            }
            return;
        }

        /* internal  */getSpaceStr(arg1: int): string
        {
            if (arg1 < 10) 
            {
                return "    ";
            }
            if (arg1 < 100) 
            {
                return "  ";
            }
            return "";
        }

        /* internal */ /* var */_labelsVec: Vector.<GLabel>;

        /* internal */ /* var */_valuesVec: Vector.<GLabel>;

        /* internal */ /* var */_label1: GLabel;

        /* internal */ /* var */_label2: GLabel;

        /* internal */ /* var */_label3: GLabel;

        /* internal */ /* var */_label4: GLabel;

        /* internal */ /* var */_label5: GLabel;

        /* internal */ /* var */_label6: GLabel;

        /* internal */ /* var */_value1: GLabel;

        /* internal */ /* var */_value2: GLabel;

        /* internal */ /* var */_value3: GLabel;

        /* internal */ /* var */_value4: GLabel;

        /* internal */ /* var */_value5: GLabel;

        /* internal */ /* var */_value6: GLabel;
    }
